﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;

namespace mytest2.webs
{
    /// <summary>
    /// Handler1 的摘要说明
    /// </summary>
    public class Handler1 : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            string domainAndName = System.Web.HttpContext.Current.User.Identity.Name;
            //string domainAndName = "sol.shuion.com.cn\\vs-movit05";
            UserInfoVO userInfoVO = MyUtils.obtianUserInfo(domainAndName);
            //context.Response.ContentType = "application/json";
            //context.Response.Write("{\"111\":\"Hello World\"}");


            //转换为Json格式
            context.Response.ContentType = "application/json";
            context.Response.ContentEncoding = System.Text.Encoding.UTF8;
            string sJsonResult = "{"
                + "\"userDomainName\":\"" + userInfoVO.userDomainName
                + "\" , \"userName\":\"" + userInfoVO.userName
                + "\" , \"timestamp\":\"" + userInfoVO.timestamp
                + "\" , \"md5\":\"" + userInfoVO.md5 
                + "\"" + "}";
            context.Response.Write(sJsonResult);
            context.Response.End(); 
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}